﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using System.Web.UI.WebControls;

namespace Service
{   
    public class UnitAPI
    {
        XmlDocument _doc = null;
        public UnitAPI()
        {
            _doc = new XmlDocument();

            string path = HttpContext.Current.Server.MapPath("~/XML/convert.xml");
            _doc.Load(path);
        }
        public ListItem[] GetListConvertName()
        { 
            XmlNodeList nodeList =  _doc.SelectNodes("/main/convert");
            ListItem[] items = new ListItem[nodeList.Count];
            int i = 0;
            foreach (XmlNode node in nodeList)
            {
                items[i] = new ListItem(node.Attributes["name"].Value);
                i++;
            }
            return items;
        }
    }
}